package com.shucoin.www.tycoin.ui.home.info;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.shucoin.www.tycoin.BaseFragment;
import com.shucoin.www.tycoin.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by happy on 2017/8/26.
 */

public class ParentInfoFt extends BaseFragment {

    @BindView(R.id.tab_layout)
    TabLayout tabLayout;
    @BindView(R.id.frame)
    FrameLayout frame;
    Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.layout_fragment_info_parent, null);
        unbinder = ButterKnife.bind(this, rootView);
        initTabView();
        return rootView;
    }

//    @Override
//    public void onStart() {
//        super.onStart();
//        String tabMEnu[]=getResources().getStringArray(R.array.info_tab_menu);
//        for (String s : tabMEnu) {
//            tabLayout.addTab(tabLayout.newTab().setText(s));
//        }
//    }

    void initTabView() {
        String tabMEnu[]=getResources().getStringArray(R.array.info_tab_menu);
        for (String s : tabMEnu) {
            tabLayout.addTab(tabLayout.newTab().setText(s));
        }
        InfoFt infoFt=new InfoFt();
        FragmentTransaction ft=getChildFragmentManager().beginTransaction();
        ft.replace(R.id.frame,infoFt).commitNow();

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
